﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace yq.Exchange
{
    internal class Reflection : ExchangeIBase
    {
        /// <summary>
        /// 内部缓存
        /// </summary>
       static Hashtable has = new Hashtable();

        public T Create<T>(RefValue rv) where T : class
        {
            object obj=has[rv.Interface];

            if(obj==null)
            {
               var _Ref = System.Reflection.Assembly.Load(rv.ReflectionPath);
               obj = _Ref.CreateInstance(rv.Class);
               has[rv.Interface] = obj;
            }

            return obj as T; 
        }
    }
}
